home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / dev / gui / gtlayout.lha / Source / gtlayout_internal.h < prev    next >
C/C++ Source or Header  |  1999-01-03  |  23KB  |  1,112 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1999 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=8
  8. */
  9.  
  10. #ifndef _GTLAYOUT_INTERNAL_H
  11. #define _GTLAYOUT_INTERNAL_H 1
  12.  
  13.     // Debugging stuff
  14.  
  15. #ifdef DEBUG
  16. #define DB(x)    x
  17. #else
  18. #define DB(x)    ;
  19. #endif    /* DEBUG */
  20.  
  21.     // Keep this one handy
  22.  
  23. VOID kprintf(STRPTR,...);
  24.  
  25.  
  26. /*****************************************************************************/
  27.  
  28.  
  29. #define NO !
  30.  
  31.  
  32. /*****************************************************************************/
  33.  
  34.  
  35.     // Keyboard qualifiers
  36.  
  37. #define QUALIFIER_SHIFT     (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
  38. #define QUALIFIER_ALT        (IEQUALIFIER_LALT | IEQUALIFIER_RALT)
  39. #define QUALIFIER_CONTROL    (IEQUALIFIER_CONTROL)
  40.  
  41.  
  42. /*****************************************************************************/
  43.  
  44.  
  45.     // Undefine these to remove various chunks of support from this code
  46.  
  47. #ifdef _GTLAYOUT_GLOBAL_H
  48. #define DO_PASSWORD_KIND
  49. #define DO_GAUGE_KIND
  50. #define DO_TAPEDECK_KIND
  51. #define DO_HEXHOOK
  52. #define DO_PICKSHORTCUTS
  53. #define DO_CLONING
  54. #define DO_LEVEL_KIND
  55. #define DO_BOOPSI_KIND
  56. #define DO_MENUS
  57. #define DO_POPUP_KIND
  58. #define DO_TAB_KIND
  59. #define DO_TEXTEDIT_KIND
  60. #else
  61. #define DO_PASSWORD_KIND
  62. #define DO_GAUGE_KIND
  63. #define DO_CLONING
  64. #define DO_BOOPSI_KIND
  65. #define DO_POPUP_KIND
  66. #endif    // _GTLAYOUT_GLOBAL_H
  67.  
  68.     // These types require that the BOOPSI_KIND support
  69.     // code is included.
  70.  
  71. #if defined(DO_LEVEL_KIND) || defined(DO_POPUP_KIND) || defined(DO_TAB_KIND) || defined(DO_TEXTEDIT_KIND)
  72. #define DO_BOOPSI_KIND
  73. #endif    /* defined(DO_LEVEL_KIND) || defined(DO_POPUP_KIND) || defined(DO_TAB_KIND) || defined(DO_TEXTEDIT_KIND) */
  74.  
  75. /*****************************************************************************/
  76.  
  77.  
  78. APTR ASM AsmCreatePool(REG(d0) ULONG MemFlags,REG(d1) ULONG PuddleSize,REG(d2) ULONG ThreshSize,REG(a6) struct Library *SysBase);
  79. VOID ASM AsmDeletePool(REG(a0) APTR PoolHeader,REG(a6) struct Library *SysBase);
  80. APTR ASM AsmAllocPooled(REG(a0) APTR PoolHeader,REG(d0) ULONG Size,REG(a6) struct Library *SysBase);
  81. VOID ASM AsmFreePooled(REG(a0) APTR PoolHeader,REG(a1) APTR Memory,REG(d0) ULONG MemSize,REG(a6) struct Library *SysBase);
  82.  
  83.  
  84. /*****************************************************************************/
  85.  
  86.  
  87.     // Scan an Exec list
  88.  
  89. #define SCANLIST(l,n)    for(n = (APTR)((struct MinList *)l)->mlh_Head; \
  90.             ((struct MinNode *)n)->mln_Succ; \
  91.             n = (APTR)((struct MinNode *)n)->mln_Succ)
  92.  
  93.     // Scan the objects of a group
  94.  
  95. #define SCANGROUP(g,n)    for(n = (APTR)g->Special . Group . ObjectList . mlh_Head; \
  96.             ((struct MinNode *)n)->mln_Succ; \
  97.             n = (APTR)((struct MinNode *)n)->mln_Succ)
  98.  
  99.     // Scan the objects of a group, only allowing active pages
  100.  
  101. #define SCANPAGE(g,n,p) for(p = 0, n = (APTR)g->Special . Group . ObjectList . mlh_Head; \
  102.             ((struct MinNode *)n)->mln_Succ; \
  103.             n = (APTR)((struct MinNode *)n)->mln_Succ) \
  104.             if ((p++ == g->Special . Group . ActivePage) || !g->Special . Group . Paging)
  105.  
  106.     // Get an object pointer from a gadget pointer
  107.  
  108. #define GETOBJECT(g,n)    ((n = (ObjectNode *)g->UserData) && (n->Host == g) && (n->PointBack == n))
  109.  
  110.  
  111. /*****************************************************************************/
  112.  
  113.  
  114. #ifdef DO_PASSWORD_KIND
  115. #define TEST_PASSWORD_KIND(n) (n->Type == PASSWORD_KIND)
  116. #else
  117. #define TEST_PASSWORD_KIND(n) (FALSE)
  118. #endif    /* DO_PASSWORD_KIND */
  119.  
  120.     // Is an object derived from STRING_KIND?
  121.  
  122. #define LIKE_STRING_KIND(n) (n->Type == STRING_KIND || n->Type == FRACTION_KIND || TEST_PASSWORD_KIND(n))
  123.  
  124.  
  125. /*****************************************************************************/
  126.  
  127.  
  128. #define NUMELEMENTS(s) (sizeof(s) / sizeof((s)[0]))
  129.  
  130. #define NOT !
  131. #define CANNOT !
  132.  
  133.  
  134. /*****************************************************************************/
  135.  
  136.  
  137. typedef char BOOLEAN;
  138.  
  139.  
  140. /*****************************************************************************/
  141.  
  142.  
  143. #define INCREMENTER_KIND    42
  144. #define PICKER_KIND        43
  145. #define GROUP_KIND        44
  146.  
  147. #define LAPR_Gadget        TAG_USER+100
  148. #define LAPR_Object        TAG_USER+101
  149.  
  150. typedef struct GaugeExtra
  151. {
  152.     LONG            InfoLength;
  153.     STRPTR            InfoText;
  154.     WORD            LastPercentage;
  155.     BOOLEAN            NoTicks;
  156.     BOOLEAN            Discrete;
  157. } GaugeExtra;
  158.  
  159. typedef struct TapeDeckExtra
  160. {
  161.     struct Image *        ButtonImage;
  162.     LONG            ButtonWidth,
  163.                 ButtonHeight;
  164.     BOOLEAN         ButtonType;
  165.     BOOLEAN            Toggle;
  166.     BOOLEAN            Smaller;
  167.     BOOLEAN            Tick;
  168. } TapeDeckExtra;
  169.  
  170. typedef struct ButtonExtra
  171. {
  172.     struct Image *        ButtonImage;
  173.     STRPTR            KeyStroke;
  174.     STRPTR *        Lines;
  175.     UBYTE            LineCount;
  176.  
  177.     BOOLEAN         ReturnKey;
  178.     BOOLEAN         EscKey;
  179.     BOOLEAN         ExtraFat;
  180.     BOOLEAN            DefaultCorrection;
  181.     BOOLEAN            Smaller;
  182. } ButtonExtra;
  183.  
  184. typedef struct BarExtra
  185. {
  186.     struct ObjectNode *    Parent;
  187.     BOOLEAN         FullSize;
  188. } BarExtra;
  189.  
  190. typedef struct BoxExtra
  191. {
  192.     struct ObjectNode *    Parent;
  193.     STRPTR *        Labels;
  194.     STRPTR *        Lines;
  195.     UWORD            Spacing;
  196.     WORD            MaxSize;
  197.     WORD            TextPen;
  198.     WORD            BackPen;
  199.     BYTE            AlignText;
  200.     BOOLEAN         DrawBox;
  201.     BOOLEAN         ReserveSpace;
  202. } BoxExtra;
  203.  
  204. typedef struct FrameExtra
  205. {
  206.     struct Hook *        RefreshHook;
  207.     UWORD            InnerWidth;
  208.     UWORD            InnerHeight;
  209.     struct Gadget        Dummy;
  210.     WORD            PlusWidth;    // Is used by the resizing process
  211.     WORD            PlusHeight;    // to change the inner width
  212.     BOOLEAN         DrawBox;
  213.     BOOLEAN            GenerateEvents;
  214.     BOOLEAN            ResizeX;
  215.     BOOLEAN            ResizeY;
  216. } FrameExtra;
  217.  
  218. typedef struct PickerExtra
  219. {
  220.     struct Gadget *        Parent;        // Important: must match IncrementerExtra!
  221.     struct Image *        Image;        // Important: must match IncrementerExtra!
  222. } PickerExtra;
  223.  
  224. typedef struct IncrementerExtra
  225. {
  226.     struct Gadget *        Parent;        // Important: must match PickerExtra!
  227.     struct Image *        Image;        // Important: must match PickerExtra!
  228.     LONG            Amount;
  229. } IncrementerExtra;
  230.  
  231. typedef struct GroupExtra
  232. {
  233.     struct MinList        ObjectList;
  234.     struct ObjectNode *    ParentGroup;
  235.     LONG            MaxOffset;
  236.     LONG            MaxSize;
  237.     ULONG            ActivePage;
  238.     UWORD            ExtraLeft;
  239.     UWORD            ExtraTop;
  240.     UWORD            FrameType;
  241.     UBYTE            MiscFlags;
  242.     BOOLEAN         Horizontal;
  243.     BOOLEAN         Paging;
  244.     BOOLEAN         Spread;
  245.     BOOLEAN         SameSize;
  246.     BOOLEAN         LastAttributes;
  247.     BOOLEAN         Visible;
  248.     BOOLEAN            Frame;
  249.     BOOLEAN            IndentX;
  250.     BOOLEAN            IndentY;
  251.     BOOLEAN            NoIndent;
  252.     BOOLEAN            AlignRight;
  253. } GroupExtra;
  254.  
  255. #define GROUPF_WidthDone    (1<<0)
  256. #define GROUPF_HeightDone    (1<<1)
  257.  
  258. typedef struct ListExtra
  259. {
  260.     struct List *        Labels;
  261.     struct Gadget *        Link;
  262.     LONG            LinkID;
  263.     struct Hook *        CallBack;
  264.     LONG            AutoPageID;
  265.     struct TextAttr *    TextAttr;
  266.     STRPTR *        ExtraLabels;
  267.     UWORD            ExtraLabelWidth;
  268.     UWORD            MaxPen;
  269.     UWORD            MaxGrowX,MaxGrowY;
  270.     UWORD            MinChars,MinLines;
  271.     WORD            FixedGlyphWidth;
  272.     WORD            FixedGlyphHeight;
  273.     BOOLEAN         ReadOnly;
  274.     BOOLEAN         CursorKey;
  275.     BOOLEAN         AllocatedList;
  276.     BOOLEAN            LockSize;
  277.     BOOLEAN            SizeLocked;
  278.     BOOLEAN            ResizeX;
  279.     BOOLEAN            ResizeY;
  280.     BOOLEAN            FlushLabelLeft;
  281.     BOOLEAN            IgnoreListContents;
  282.     BOOLEAN            AdjustForString;
  283. } ListExtra;
  284.  
  285. typedef struct RadioExtra
  286. {
  287.     STRPTR *        Choices;
  288.     LONG            AutoPageID;
  289.     UWORD            LabelWidth;
  290.     UBYTE            TitlePlace;
  291.     BOOLEAN            TabKey;
  292. } RadioExtra;
  293.  
  294. typedef struct TextExtra
  295. {
  296.     STRPTR            Text;
  297.     struct Gadget *        Picker;
  298.     WORD            FrontPen;
  299.     WORD            BackPen;
  300.     UWORD            Len;
  301.     UBYTE            Justification;
  302.     BOOLEAN         Border;
  303.     BOOLEAN         CopyText;
  304.     BOOLEAN         UsePicker;
  305.     BOOLEAN            LockSize;
  306.     BOOLEAN            SizeLocked;
  307. } TextExtra;
  308.  
  309. typedef struct NumberExtra
  310. {
  311.     LONG            Number;
  312.     STRPTR            Format;
  313.     WORD            FrontPen;
  314.     WORD            BackPen;
  315.     WORD            MaxNumberLen;
  316.     UBYTE            Justification;
  317.     BOOLEAN         Border;
  318. } NumberExtra;
  319.  
  320. typedef struct CycleExtra
  321. {
  322.     STRPTR *        Choices;
  323.     LONG            AutoPageID;
  324.     BOOLEAN            TabKey;
  325. } CycleExtra;
  326.  
  327. typedef struct PalExtra
  328. {
  329.     UBYTE *            ColourTable;
  330.     UBYTE *            TranslateBack;
  331.     struct Gadget *        Picker;
  332.     UWORD            Depth;
  333.     UWORD            NumColours;
  334.     UWORD            IndicatorWidth;
  335.     BOOLEAN         SmallPalette;
  336.     BOOLEAN            UsePicker;
  337. } PalExtra;
  338.  
  339. typedef struct SliderExtra
  340. {
  341.     STRPTR            LevelFormat;
  342.     DISPFUNC        DispFunc;
  343.     LONG            MaxLevelLen;
  344.     LONG            LevelWidth;
  345.     STRPTR            OriginalLabel;
  346.     UBYTE            LevelPlace;
  347.     BOOLEAN         FullLevelCheck;
  348. } SliderExtra;
  349.  
  350. typedef struct StringExtra
  351. {
  352.     struct LayoutHandle *    LayoutHandle;
  353.     struct Hook *        HistoryHook;
  354.     ULONG            MaxHistoryLines;
  355.     ULONG            NumHistoryLines;
  356.     struct Node *        CurrentNode;
  357.  
  358.     STRPTR            String;
  359.     LONG            MaxChars;
  360.     struct Hook *        EditHook;
  361.     struct Hook *        ValidateHook;
  362.     struct Gadget *        Picker;
  363.     STRPTR            Backup;
  364.     STRPTR            RealString;
  365.     STRPTR            Original;
  366.     LONG            LinkID;
  367.  
  368.     struct Gadget *        LeftIncrementer;
  369.     struct Gadget *        RightIncrementer;
  370.  
  371.     struct Hook *        IncrementerHook;
  372.  
  373.     UBYTE            Justification;
  374.     BOOLEAN         LastGadget;
  375.     BOOLEAN         UsePicker;
  376.     BOOLEAN            Activate;
  377. } StringExtra;
  378.  
  379. typedef struct IntegerExtra
  380. {
  381.     struct LayoutHandle *    LayoutHandle;
  382.     struct Hook *        HistoryHook;
  383.     ULONG            MaxHistoryLines;
  384.     ULONG            NumHistoryLines;
  385.     struct Node *        CurrentNode;
  386.  
  387.     struct Gadget *        LeftIncrementer;
  388.     struct Gadget *        RightIncrementer;
  389.  
  390.     struct Hook *        IncrementerHook;
  391.  
  392.     LONG            Number;
  393.     LONG            MaxChars;
  394.     struct Hook *        EditHook;
  395.     struct Hook *        ValidateHook;
  396.  
  397.     UBYTE            Justification;
  398.     BOOLEAN         LastGadget;
  399.     BOOLEAN         UseIncrementers;
  400.     BOOLEAN            CustomHook;
  401.     BOOLEAN            Activate;
  402. } IntegerExtra;
  403.  
  404. typedef struct ScrollerExtra
  405. {
  406.     struct ObjectNode *    Parent;
  407.     WORD            Visible;
  408.     WORD            ArrowSize;
  409.     BOOLEAN         RelVerify;
  410.     BOOLEAN            Immediate;
  411.     BOOLEAN            Arrows;
  412.     BOOLEAN            Vertical;
  413.     BOOLEAN            Thin;
  414.     BOOLEAN            FullSize;
  415. } ScrollerExtra;
  416.  
  417. typedef struct LevelExtra
  418. {
  419.     WORD            Freedom;
  420.     WORD            Ticks;
  421.     WORD            NumTicks;
  422.     LONG            Plus;
  423.     STRPTR            LevelFormat;
  424.     DISPFUNC        DispFunc;
  425.     LONG            MaxLevelWidth;
  426.     LONG            LevelPlace;
  427.     BOOLEAN            FullLevelCheck;
  428. } LevelExtra;
  429.  
  430. typedef struct BOOPSIExtra
  431. {
  432.     struct Library *    ClassBase;
  433.     Class *            ClassInstance;
  434.     STRPTR            ClassName;
  435.     STRPTR            ClassLibraryName;
  436.     struct TagItem *    ClassTags;
  437.     ULONG            TagCurrent,
  438.                 TagTextAttr,
  439.                 TagDrawInfo,
  440.                 TagLink,
  441.                 TagScreen;
  442.     LONG            Link;
  443.     struct ObjectNode *    Parent;
  444.     struct Hook *        ActivateHook;
  445.     WORD            ExactWidth,
  446.                 ExactHeight;
  447.     WORD            RelFontHeight;
  448.     BOOLEAN            FullWidth;
  449.     BOOLEAN            FullHeight;
  450. } BOOPSIExtra;
  451.  
  452. typedef struct PopupExtra
  453. {
  454.     STRPTR *        Choices;
  455.     LONG            AutoPageID;
  456.     BOOLEAN            TabKey;
  457.     BOOLEAN            CentreActive;
  458. } PopupExtra;
  459.  
  460. typedef struct TabExtra
  461. {
  462.     STRPTR *        Choices;
  463.     LONG            AutoPageID;
  464.     struct ObjectNode *    Parent;
  465.     BOOLEAN            TabKey;
  466.     BOOLEAN            FullWidth;
  467.     BOOLEAN            FrameGroup;
  468. } TabExtra;
  469.  
  470. typedef struct ImageExtra
  471. {
  472.     struct Image *        Image;
  473.     struct BitMap *        BitMap;
  474.     PLANEPTR        BitMapMask;
  475.     UWORD            BitMapLeft;
  476.     UWORD            BitMapTop;
  477.     UWORD            BitMapWidth;
  478.     UWORD            BitMapHeight;
  479. } ImageExtra;
  480.  
  481. typedef struct TextEditExtra
  482. {
  483.     STRPTR            String;
  484.     STRPTR            Backup;
  485.     struct TextAttr *    TextAttr;
  486.     struct TextFont *    Font;
  487.     BOOLEAN         LastGadget;
  488.     BOOLEAN            Activate;
  489. } TextEditExtra;
  490.  
  491. typedef struct ObjectNode
  492. {
  493.     struct MinNode        Node;
  494.     struct Gadget *        Host;
  495.     struct ObjectNode *    PointBack;
  496.     STRPTR            Label;
  497.     LONG            ID;
  498.     LONG            Min;
  499.     LONG            Max;
  500.     LONG            Current;
  501.     APTR            Storage;
  502.  
  503.     UWORD            Left;
  504.     UWORD            Top;
  505.     UWORD            Width;
  506.     UWORD            Height;
  507.     UWORD            LabelWidth;
  508.     UWORD            Lines;
  509.     UWORD            Chars;
  510.     UWORD            LayoutSpace;
  511.     WORD            ExtraSpace;
  512.     WORD            LabelChars;
  513.  
  514.     UBYTE            Type;
  515.     BYTE            LabelPlace;
  516.     UBYTE            Key;
  517.     UBYTE            StorageType;
  518.     BOOLEAN            DefaultSize;
  519.     BOOLEAN         Disabled;
  520.     BOOLEAN         NoKey;
  521.     BOOLEAN         HighLabel;
  522.     BOOLEAN         GroupIndent;
  523.     BOOLEAN         PageSelector;
  524.  
  525.     union
  526.     {
  527.         GaugeExtra        Gauge;
  528.         TapeDeckExtra        TapeDeck;
  529.         ButtonExtra        Button;
  530.         BarExtra        Bar;
  531.         BoxExtra        Box;
  532.         FrameExtra        Frame;
  533.         PickerExtra        Picker;
  534.         IncrementerExtra    Incrementer;
  535.         GroupExtra        Group;
  536.         ListExtra        List;
  537.         RadioExtra        Radio;
  538.         TextExtra        Text;
  539.         NumberExtra        Number;
  540.         CycleExtra        Cycle;
  541.         PalExtra        Palette;
  542.         SliderExtra        Slider;
  543.         StringExtra        String;
  544.         IntegerExtra        Integer;
  545.         ScrollerExtra        Scroller;
  546.         LevelExtra        Level;
  547.         BOOPSIExtra        BOOPSI;
  548.         PopupExtra        Popup;
  549.         TabExtra        Tab;
  550.         ImageExtra        Image;
  551.         TextEditExtra        TextEdit;
  552.     } Special;
  553. } ObjectNode;
  554.  
  555. typedef struct LayoutHandle
  556. {
  557.         // WARNING: Beginning of this structure must match the definition in gtlayout.h!
  558.  
  559.     struct Screen *        Screen;
  560.     struct DrawInfo *    DrawInfo;
  561.     struct Window *        Window;
  562.     APTR            VisualInfo;
  563.     struct Image *        AmigaGlyph;
  564.     struct Image *        CheckGlyph;
  565.     APTR            UserData;
  566.     struct Menu *        Menu;
  567.  
  568.         // End of public part
  569.  
  570.     struct Screen *        PubScreen;
  571.     struct MsgPort *    MsgPort;
  572.     struct Gadget **    GadgetArray;
  573.     struct Gadget *        Previous;
  574.     struct Gadget *        List;
  575.     struct Image *        BevelImage;
  576.     struct Image *        GrooveImage;
  577.     APTR            WindowUserData;
  578.     ULONG            IDCMP;
  579.     ULONG            WA_ScreenTag;
  580.     BOOL            UnlockPubScreen;
  581.     BOOL            UseGroove;
  582.  
  583.         // BOOPSI support
  584.  
  585.     Object *        BOOPSIPrevious;
  586.     Object *        BOOPSIList;
  587.  
  588.         // Incrementers
  589.  
  590.     ObjectNode *        ActiveIncrementer;
  591.     WORD            IncrementerCountdown;
  592.     WORD            IncrementerAccelerate;
  593.     LONG            IncrementerIncrement;
  594.  
  595.         // Frames
  596.  
  597.     ObjectNode *        ActiveFrame;
  598.  
  599.         // Cached from DrawInfo structure
  600.  
  601.     UWORD            TextPen;
  602.     UWORD            BackgroundPen;
  603.     UWORD            ShadowPen;
  604.     UWORD            ShinePen;
  605.  
  606.     UWORD            AspectX;
  607.     UWORD            AspectY;
  608.  
  609.         // Double-click support
  610.  
  611.     ULONG            ClickSeconds;
  612.     ULONG            ClickMicros;
  613.     ObjectNode *        ClickObject;
  614.  
  615.     struct Hook *        LocaleHook;
  616.     struct TextAttr *    TextAttr;
  617.     struct TextAttr *    InitialTextAttr;
  618.     struct TTextAttr    CopyTextAttr;
  619.     struct RastPort     RPort;
  620.  
  621.     APTR            Pool;
  622.  
  623.     UWORD            GlyphWidth;
  624.     UWORD            GlyphHeight;
  625.  
  626.     UWORD            InterWidth;
  627.     UWORD            InterHeight;
  628.  
  629.     LONG            Count;
  630.  
  631.     LONG            Index;
  632.  
  633.     ObjectNode *        TopGroup;
  634.     ObjectNode *        CurrentGroup;
  635.     ObjectNode *        EscKey;
  636.     ObjectNode *        ReturnKey;
  637.     ObjectNode *        CursorKey;
  638.     ObjectNode *        GrowView;
  639.     ObjectNode *        ResizeObject;
  640.     ObjectNode *        TabKey;
  641.     ObjectNode *        ActiveString;
  642. #ifdef DO_PASSWORD_KIND
  643.     struct Hook        PasswordEditHook;
  644. #endif
  645. #ifdef DO_HEXHOOK
  646.     struct Hook        HexEditHook;
  647. #endif    /* DO_HEXHOOK */
  648.     struct Hook        DefaultEditHook;
  649.     struct Hook *        StandardEditHook;
  650.  
  651.     struct Hook        BackfillHook;
  652.     struct RastPort        BackfillRastPort;
  653.  
  654. #ifdef DO_LEVEL_KIND
  655.     ObjectNode *        CurrentLevel;
  656. #endif    /* DO_LEVEL_KIND */
  657.  
  658.     struct TTextAttr    FixedFont;
  659.  
  660.     struct LayoutHandle *    PointBack;
  661.  
  662.     LONG            GroupID;
  663.  
  664. #ifdef DO_PICKSHORTCUTS
  665.     UBYTE            Keys[256];
  666. #endif    /* DO_PICKSHORTCUTS */
  667.  
  668.     struct Window *        Parent;        // Parent of this window
  669.     struct Hook *        HelpHook;        // Hook to call when help key is pressed
  670.     LONG            MaxPen;
  671.  
  672.     WORD            SizeWidth;
  673.     WORD            SizeHeight;
  674.  
  675.     BOOLEAN            SizeVerified;
  676.     BOOLEAN         AutoRefresh;
  677.     BOOLEAN         CloseFont;
  678.     BOOLEAN         Failed;
  679.     BOOLEAN         Rescaled;
  680.     BOOLEAN         AutoActivate;
  681.     BOOLEAN         MoveToWindow;
  682.     BOOLEAN            NeedDelay;
  683.     BOOLEAN            RawKeyFilter;
  684.     BOOLEAN            FlushLeft;
  685.     BOOLEAN            FlushTop;
  686.     BOOLEAN            BlockParent;
  687.     BOOLEAN            ExitFlush;
  688.     BOOLEAN            NoKeys;
  689.  
  690. #ifdef DO_CLONING
  691.     struct CloneExtra *    CloneExtra;        // Screen cloning information
  692.     STRPTR            CloneScreenTitle;    // Title of the cloned screen, if any
  693.     BOOLEAN         CloningPermitted;    // Genetic engineering?
  694.     BOOLEAN         ExactClone;        // Make an exact copy, i.e. preserve all colours
  695.     BOOLEAN            SimpleClone;        // Just a simple clone, please
  696.     BYTE            Pad0;
  697. #endif
  698.  
  699.     BOOLEAN            CloseTopGroup;        // Close the top group at LT_Build() time
  700. } LayoutHandle;
  701.  
  702. #define PHANTOM_GROUP_ID    -10000    // Phantom groups, i.e those without proper
  703.                     // IDs start with this ID
  704.  
  705. /*****************************************************************************/
  706.  
  707.  
  708.     // Window locking
  709.  
  710. typedef struct LockNode
  711. {
  712.     struct MinNode        MinNode;
  713.     struct Window *        Window;
  714.     LONG            Count;
  715.     ULONG            OldIDCMPFlags;
  716.     struct Requester    Requester;
  717.     LONG            MinWidth;
  718.     LONG            MinHeight;
  719.     LONG            MaxWidth;
  720.     LONG            MaxHeight;
  721. } LockNode;
  722.  
  723.  
  724. /*****************************************************************************/
  725.  
  726.  
  727.     // Image class extension
  728.  
  729. typedef struct ImageInfo
  730. {
  731.     STRPTR *        Lines;        // Text lines
  732.     STRPTR            KeyStroke;    // Points to char that acts as keystroke identifier
  733.  
  734.     STRPTR            Label;        // Single label if any
  735.  
  736.     struct TextFont *    Font;        // Open font if any
  737.     struct Image *        FrameImage;    // Button frame imagery, if any
  738.  
  739.     UWORD            ImageType;    // Type
  740.  
  741.     UWORD            GlyphWidth;    // Size
  742.     UWORD            GlyphHeight;
  743.  
  744.     UWORD            LineCount;    // Number of lines below
  745.  
  746.     BOOLEAN            Emboss;    // Emboss the bevel box
  747.     BOOLEAN            UseFrame;    // Always use the frame image?
  748. } ImageInfo;
  749.  
  750.     // Image class extension types
  751.  
  752. #define IIA_ImageType    (TAG_USER+739)
  753. #define IIA_GlyphWidth    (TAG_USER+740)
  754. #define IIA_GlyphHeight    (TAG_USER+741)
  755. #define IIA_Lines    (TAG_USER+742)
  756. #define IIA_LineCount    (TAG_USER+743)
  757. #define IIA_KeyStroke    (TAG_USER+744)
  758. #define IIA_Emboss    (TAG_USER+745)
  759. #define IIA_Label    (TAG_USER+746)
  760. #define IIA_Font    (TAG_USER+747)
  761.  
  762.     // Supported image class extension types
  763.  
  764. enum
  765. {
  766.     IMAGECLASS_PICKER,
  767.     IMAGECLASS_LEFTINCREMENTER,
  768.     IMAGECLASS_RIGHTINCREMENTER,
  769.     IMAGECLASS_BACKWARD,
  770.     IMAGECLASS_FORWARD,
  771.     IMAGECLASS_PREVIOUS,
  772.     IMAGECLASS_NEXT,
  773.     IMAGECLASS_RECORD,
  774.     IMAGECLASS_PLAY,
  775.     IMAGECLASS_STOP,
  776.     IMAGECLASS_PAUSE,
  777.     IMAGECLASS_REWIND,
  778.     IMAGECLASS_EJECT,
  779.     IMAGECLASS_MULTILINEBUTTON
  780. };
  781.  
  782.  
  783. /*****************************************************************************/
  784.  
  785.  
  786. struct SliderClassData
  787. {
  788.     BOOL            IsVertical;
  789.     WORD            UseTicks;
  790.  
  791.     UWORD            Width;
  792.     UWORD            Height;
  793.  
  794.     UWORD            SeparatorSpace;
  795.     UWORD            TickSpace;
  796.  
  797.     UWORD            TickTop;
  798.     UWORD            RailTop;
  799.     UWORD            ThumbTop;
  800.  
  801.     UWORD            ThumbWidth;
  802.     UWORD            ThumbHeight;
  803.  
  804.     UWORD            ThumbLeft;
  805.     UWORD            ThumbLast;
  806.     ULONG            ThumbPosition;
  807.     ULONG            ThumbMax;
  808.     ULONG            NumTicks;
  809.  
  810.     struct DrawInfo *    DrawInfo;
  811.  
  812.     struct BitMap        ThumbBitMap;
  813.  
  814.     LONG            ActiveOffset;
  815.     BOOL            DirectHit;
  816. };
  817.  
  818. #define    SLA_Dummy     (TAG_USER+0x700000)
  819.  
  820. #define SLA_DrawInfo    (SLA_Dummy+1)
  821. #define SLA_Current    (SLA_Dummy+2)
  822. #define SLA_Max        (SLA_Dummy+3)
  823. #define SLA_Position    (SLA_Dummy+4)
  824. #define SLA_NumTicks    (SLA_Dummy+5)
  825. #define SLA_UseTicks    (SLA_Dummy+6)
  826. #define SLA_Reference    (SLA_Dummy+7)
  827.  
  828.  
  829. /*****************************************************************************/
  830.  
  831.  
  832. enum
  833. {
  834.     STORAGE_BYTE,STORAGE_UBYTE,
  835.     STORAGE_WORD,STORAGE_UWORD,
  836.     STORAGE_LONG,STORAGE_ULONG,
  837.     STORAGE_STRPTR
  838. };
  839.  
  840.  
  841. /*****************************************************************************/
  842.  
  843.  
  844.     // A single colour in 96 bit precision
  845.  
  846. struct ColourTriplet
  847. {
  848.     ULONG Red;        // 32 bits each
  849.     ULONG Green;
  850.     ULONG Blue;
  851. };
  852.  
  853.     // A colour table ready to submit to LoadRGB32
  854.  
  855. struct ColourRecord
  856. {
  857.     UWORD            NumColours;    // Number of colours in this chunk
  858.     UWORD            FirstColour;    // First colour entry to set
  859.  
  860.     struct ColourTriplet    Triplets[0];    // Table entries
  861.  
  862.     WORD            Arnold;     // Array terminator, needs to be set to zero
  863. };
  864.  
  865.     // Screen reproduction
  866.  
  867. struct CloneExtra
  868. {
  869.     struct Screen *    Screen;
  870.     LONG *        Pens;
  871.     UWORD *        ScreenPens;
  872.     UWORD        MinWidth,
  873.             MinHeight,
  874.             MaxWidth,
  875.             MaxHeight,
  876.             TotalPens;
  877.     UBYTE        Depth;
  878.     struct IBox    Bounds;
  879. };
  880.  
  881.  
  882. /*****************************************************************************/
  883.  
  884.  
  885. #define ITEMF_HasSub    (1 << 0)        // Next item is a subitem
  886. #define ITEMF_FirstSub    (1 << 1)        // This is the first subitem
  887. #define ITEMF_IsSub    (1 << 2)        // This is a subitem
  888. #define ITEMF_LastItem    (1 << 3)        // This is the last item
  889. #define ITEMF_IsBar    (1 << 4)        // This is a separator bar
  890. #define ITEMF_Command    (1 << 5)        // This item has a long command key sequence
  891.  
  892. typedef struct ItemNode
  893. {
  894.     struct MinNode     Node;
  895.     struct MenuItem     Item;
  896.     APTR         UserData;
  897.     ULONG         ID;            // Item ID
  898.  
  899.     STRPTR         ExtraLabel;        // For long command sequence labels
  900.     UWORD         Flags;            // Flag bits as defined above
  901.     WORD         Left,            // Actual left edge
  902.              Top;            // Actual top edge
  903.     WORD         Width;            // Actual width
  904.  
  905.     UWORD         MenuCode;        // Intuition menu code
  906.  
  907.     ULONG         Qualifier;        // Message qualifier
  908.     UWORD         Code;            // Message code
  909.     UBYTE         Char;            // ASCII code
  910. } ItemNode, *pItemNode;
  911.  
  912. typedef struct MenuNode
  913. {
  914.     struct MinNode     Node;
  915.     struct Menu     Menu;
  916.     APTR         UserData;
  917.     ULONG         ID;            // Item ID
  918.  
  919.     WORD         Width;            // Actual width
  920.  
  921.     UWORD         MenuCode;        // Intuition menu code
  922. } MenuNode, *pMenuNode;
  923.  
  924. typedef struct RootMenu
  925. {
  926.     APTR            Pool;        // Memory allocation
  927.     struct TextFont *    Font;        // Preferred item font
  928.     struct TextAttr *    TextAttr;    // What goes into the single items
  929.     struct TTextAttr    BoldAttr;    // Same as above, just in boldface
  930.     struct DrawInfo *    DrawInfo;    // Screen drawing info
  931.     struct Screen *        Screen;        // The screen we are building the menu for
  932.     struct RastPort        RPort;        // Dummy RastPort for font measuring
  933.  
  934.     WORD            ItemHeight;    // Default item height
  935.     UWORD            TextPen;    // Text rendering pen
  936.  
  937.     ULONG            CheckWidth,    // Size of the checkmark glyph
  938.                 CheckHeight,
  939.                 AmigaWidth,    // Size of the Amiga glyph
  940.                 AmigaHeight;
  941.  
  942.     struct MinList        MenuList;    // List of menus
  943.     struct MinList        ItemList;    // List of menu items
  944.  
  945.     LayoutHandle *        Handle;        // Layout handle if any
  946.     struct Hook *        LocaleHook;    // Localization, if no handle is provided
  947.  
  948.     struct MinNode        Node;        // The initial menu all the data is tied to
  949.     struct Menu        Menu;
  950.     APTR            UserData;
  951.     ULONG            ID;
  952.     WORD            Width;
  953.     UWORD            MenuCode;
  954. } RootMenu, *pRootMenu;
  955.  
  956.  
  957. /*****************************************************************************/
  958.  
  959.  
  960. typedef struct PopInfo
  961. {
  962.     struct CheckGlyph *    CheckGlyph;
  963.  
  964.     LONG            MaxLen;
  965.     LONG            MaxWidth;
  966.  
  967.     struct Window *        Window;
  968.     struct TextFont    *    Font;
  969.  
  970.     LONG            TopMost;
  971.  
  972.     LONG            LastDrawn;
  973.     LONG            LastLabelDrawn;
  974.  
  975.     struct Image *        FrameImage;
  976.  
  977.     STRPTR *        Labels;
  978.     LONG            NumLabels;
  979.     LONG            Active;
  980.     LONG            InitialActive;
  981.     UWORD            ActiveLen;
  982.  
  983.     UWORD            MarkLeft;
  984.     UWORD            MarkWidth;
  985.  
  986.     UWORD            LabelLeft;
  987.     UWORD            LabelTop;
  988.  
  989.     UWORD            LineTop;
  990.  
  991.     UWORD            ArrowTop;
  992.     UWORD            ArrowWidth;
  993.     UWORD            ArrowHeight;
  994.  
  995.     UWORD            PickerWidth;
  996.  
  997.     UWORD            PopLeft;
  998.     UWORD            PopWidth;
  999.  
  1000.     UWORD            BoxLeft,BoxTop,
  1001.                 BoxWidth,BoxHeight;
  1002.  
  1003.     UWORD            BoxLines;
  1004.  
  1005.     UWORD            SingleWidth,
  1006.                 SingleHeight;
  1007.  
  1008.     UWORD            AspectX;
  1009.     UWORD            AspectY;
  1010.  
  1011.     UWORD            MenuText,MenuBack;
  1012.     UWORD            MenuTextSelect,MenuBackSelect;
  1013.  
  1014.     UBYTE            Flags;
  1015.     BOOLEAN            Blocked;
  1016.     BOOLEAN            CentreActive;
  1017. } PopInfo;
  1018.  
  1019. #define PIA_Labels        (TAG_USER+0x80000)
  1020. #define PIA_Active        (TAG_USER+0x80001)
  1021. #define PIA_Font        (TAG_USER+0x80002)
  1022. #define PIA_Highlight        (TAG_USER+0x80003)
  1023. #define PIA_CentreActive    (TAG_USER+0x80004)
  1024. #define PIA_AspectX        (TAG_USER+0x80005)
  1025. #define PIA_AspectY        (TAG_USER+0x80006)
  1026.  
  1027.  
  1028. /*****************************************************************************/
  1029.  
  1030.  
  1031. typedef struct TabEntry
  1032. {
  1033.     struct BitMap *    BitMap;
  1034.     UWORD        Left;
  1035. } TabEntry;
  1036.  
  1037. typedef struct TabInfo
  1038. {
  1039.     struct BitMap *    BitMap;
  1040.     struct RastPort    RPort;
  1041.     PLANEPTR    Mask;
  1042.  
  1043.     TabEntry *    Tabs;
  1044.     WORD        Count;
  1045.     WORD        Current;
  1046.     WORD        Initial;
  1047.  
  1048.     UWORD        Thick;
  1049.     UWORD        TabWidth;
  1050.     UWORD        TabHeight;
  1051.  
  1052.     WORD        Offset;
  1053. } TabInfo;
  1054.  
  1055. #define TIA_Labels    (TAG_USER+0x90000)
  1056. #define TIA_Font    (TAG_USER+0x90001)
  1057. #define TIA_Screen    (TAG_USER+0x90002)
  1058. #define TIA_Index    (TAG_USER+0x90003)
  1059. #define TIA_DrawInfo    (TAG_USER+0x90004)
  1060. #define TIA_SizeType    (TAG_USER+0x90005)
  1061.  
  1062.  
  1063. /*****************************************************************************/
  1064.  
  1065. typedef struct TextEditInfo
  1066. {
  1067.     struct TextEditContext *    tei_Context;
  1068.     struct DrawInfo *        tei_DrawInfo;
  1069.     struct Image *            tei_Frame;
  1070.     UWORD                tei_FrameLeft;
  1071.     UWORD                tei_FrameTop;
  1072.     struct KeyMap *            tei_AltKeyMap;
  1073.     BOOL                tei_Dragging;
  1074.     BOOL                tei_NoFilterMode;
  1075.     BOOL                tei_ExitHelp;
  1076. } TextEditInfo;
  1077.  
  1078.  
  1079. /*****************************************************************************/
  1080.  
  1081.  
  1082. struct CheckGlyph
  1083. {
  1084.     UWORD        Width,
  1085.             Height;
  1086.     struct BitMap *    Plain;
  1087.     struct BitMap *    Selected;
  1088. };
  1089.  
  1090.  
  1091. /*****************************************************************************/
  1092.  
  1093. /* These may not be defined in the default header files. */
  1094.  
  1095. #ifndef GDOMAIN_MINIMUM
  1096. #define    GDOMAIN_MINIMUM (0)    /* Minimum size */
  1097. #endif    /* GDOMAIN_MINIMUM */
  1098.  
  1099. #ifndef GDOMAIN_NOMINAL
  1100. #define    GDOMAIN_NOMINAL    (1)    /* Nominal size */
  1101. #endif    /* GDOMAIN_NOMINAL */
  1102.  
  1103. #ifndef GDOMAIN_MAXIMUM
  1104. #define    GDOMAIN_MAXIMUM    (2)    /* Maximum size */
  1105. #endif    /* GDOMAIN_MAXIMUM */
  1106.  
  1107.  
  1108. /*****************************************************************************/
  1109.  
  1110.  
  1111. #endif
  1112.